package sys.news.vo;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;

public class HttpServletRequestVo extends HttpServletRequestWrapper {
   private Map<String,String > map;
    public HttpServletRequestVo(HttpServletRequest request) {
        super(request);
        map = (HashMap)this.getServletContext().getAttribute("textMap");
    }

    @Override
    public String getParameter(String name) {
        System.out.println("getVoParameter");
        String oldValue = super.getParameter(name);
        Set<String> keys = map.keySet();
        Iterator<String> it= keys.iterator();
        while(it.hasNext()){
           String key = it.next();
           String value = map.get(key);
           oldValue = oldValue.replace(key,value);
        }
        return super.getParameter(name);
    }
}
